<?php
header("content-type:text/html;charset=utf-8");
$username = $_POST["username"];
$pwd = md5($_POST["pwd"]);
$creatTime = date('Y-m-d h:i:s', time());
$email = $_POST["email"];
$motto = $_POST["motto"];
$sex = $_POST["sex"] == "option1"?'1':'0';
var_dump($username);
var_dump($sex);
//造对象
$db = new mysqli("localhost", "root", "", "xhm");
mysqli_set_charset($db,'utf8');
//判断是否出错
!mysqli_connect_error() or die("连接失败！");
//sql语句
$sql = "INSERT INTO `xhm`.`user` ( `userName`, `password`, `createTime`, `email`, `motto`, `sex`) 
VALUES ( '{$username}', '{$pwd}', '{$creatTime}', '{$email}', '{$motto}', '{$mradio}')";
//执行sql
$result = $db->query($sql);
var_dump($result);
if($result){
    echo "注册成功!";
}else{
    echo "注册失败!";
}
?>